#!/bin/bash

# 检查操作系统是否为Ubuntu或Debian
OS_ID=$(grep '^ID=' /etc/os-release | cut -d= -f2 | tr -d '\"')
if [[ ! "$OS_ID" =~ ^(ubuntu|debian)$ ]]; then
    echo "此脚本仅支持Ubuntu或Debian系统。"
    exit 1
fi

# 检查是否安装了ROCM
if ! dpkg -l | grep -qw rocm; then
    echo "ROCm 未安装，请先安装ROCm。"
    exit 1
fi

# 更新系统并安装必要的软件包
sudo apt update && sudo apt upgrade -y
sudo apt install -y git python3-pip python3-venv python3-dev libstdc++-12-dev wget curl cmake libmsgpack-dev gfortran libgtest-dev
sudo pip install joblib

# 克隆和构建rocBLAS
git clone https://github.com/ROCmSoftwarePlatform/rocBLAS.git
cd rocBLAS
./install.sh -c --clients
